package com.sanji.pay.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * 支付单号的生成规则
 * Created by cbh on 2017/8/28.
 */
public class PayNumUtil {
  public static String setPayNum(){
    SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
    String temp = sf.format(new Date());
    String str = "0123456789";
    StringBuilder sb=new StringBuilder(4);
    for(int i=0;i<5;i++)
    {
      char ch=str.charAt(new Random().nextInt(str.length()));
      sb.append(ch);
    }
    String payNum = temp.substring(2,temp.length()) + sb.toString();
    return payNum;
  }
}
